package com.example.myapplication.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.example.myapplication.R;
import com.example.myapplication.base.BaseRlvAdapter;
import com.example.myapplication.bean.NavigationBean;
import com.example.myapplication.swdget.FlowLayout;

import java.util.List;

public class NavigationAdapter extends BaseRlvAdapter<NavigationBean.DataBean> {

    public NavigationAdapter(Context context, List<NavigationBean.DataBean> list) {
        super(context, list);
    }

    @Override
    protected void bindData(BaseViewHolder holder, NavigationBean.DataBean dataBean) {
        FlowLayout fl = (FlowLayout) holder.itemView;
        List<NavigationBean.DataBean.ArticlesBean> articles = dataBean.getArticles();

        for (int i = 0; i < articles.size(); i++) {
            NavigationBean.DataBean.ArticlesBean articlesBean = articles.get(i);
            TextView view = (TextView) LayoutInflater.from(mContext).inflate(R.layout.item_laber, null);
            view.setText(articlesBean.getTitle());
            fl.addView(view);
        }
    }

    @Override
    protected int getLayout() {
        return R.layout.item_systems;
    }
}
